<!--
 * @description  : 案件详情信息-文书模板
 * @descriptionDetail: 案件详情信息-文书模板
 * @copyright    : 浙江烟草
 * @author       : sy
 * @create       : 2022-07-09 18:43:02
-->
<template>
  <view class="page">
    <theme-navbar :isWhite="true" backText="返回" title="文书模板"></theme-navbar>	
    <view class="content">
      <view class="temp-content">
        <u-form :model="dataForm" :rules="rules" :errorType="errorType" ref="uForm">
          <u-form-item :label-position="labelPosition" :label="item.name" v-for="(item,index) in dataList" :key="index">
            <u-input :border="border" type="select" :select-open="selectShow" placeholder="请选择" class="text-right" v-model="dataForm[item.fileldName]" @click="handleClick(index)" />
            <u-select mode="single-column" :list="selectList" v-model="selectShow" @confirm="selectConfirm"></u-select>
          </u-form-item>
        </u-form>
      </view> 
    </view>
    <view class="space-content"></view>
    <u-button plain class="flat-btn" type="primary" @click="saveHandle">
      保存
    </u-button>
  </view>
</template>

<script>
export default{
  data() {
    return {
      dataForm:{},
      rules:{},
      errorType: ['border-bottom','message',],
      labelPosition:"top",
      border: false,
      selectShow:false,
      selectList:[],
      selectFiled:"",
      dataList:[
        {name:"询问笔录模板",fileldName:"askRecordTemp",list:[{
          value: '1',
          label: '询问笔录模板1',
        },
        {
          value: '2',
          label: '询问笔录模板2',
        },
        {
          value: '3',
          label: '询问笔录模板3',
        },],},
        {name:"检查勘验笔录模板",fileldName:"checkRecordTemp",list:[{
          value: '1',
          label: '检查勘验笔录模板1',
        },
        {
          value: '2',
          label: '检查勘验笔录模板2',
        },
        {
          value: '3',
          label: '检查勘验笔录模板3',
        },],},
      ],
    }
  },
  mounted() {
		
  },
  methods: {
    handleClick(index){
      this.selectShow = true;
      this.selectList = this.dataList[index].list;
      this.selectFiled = this.dataList[index].fileldName;
    },
    selectConfirm(e) {    
      let filedVal = this.selectFiled + 'Val';
      this.dataForm[this.selectFiled] = '';
      e.map((val, index) => {   
        this.dataForm[this.selectFiled] = val.label;
        this.dataForm[filedVal] = val.value;
      });
      console.log(this.dataForm);
    },
    saveHandle(){
      
    },
  },
	
}
</script>

<style lang="scss" scoped>
	@import "../case_common.scss";
	.content{
		.temp-content{
			padding: 0px 16px 16px;
		}
	}	
</style>
